
package com.task.base;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class ShortcutCreateActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        if (intent != null && Intent.ACTION_CREATE_SHORTCUT.equals(intent.getAction())) {
            Intent i = new Intent("android.intent.action.MAIN");
            i.setClassName(this, ShortcutActivity.class.getName());
            Intent shortcutIntent = new Intent();
            shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, i);
            shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME,
                    getResources().getString(R.string.shortcut_title));
            shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                    Intent.ShortcutIconResource.fromContext(this, R.drawable.widget_icon));
            setResult(RESULT_OK, shortcutIntent);
        }
        finish();
        return;
    }

}
